package 乙级;

import java.util.Scanner;

/**
 * @author mubei
 * @date 2021/8/20
 * @description
 */
public class 统计同成绩学生 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int[] score = new int[101];

        for (int i = 0; i < n; i++) {
            int s = scanner.nextInt();
            score[s]++;
        }

        int m = scanner.nextInt();
        int[] res = new int[m];
        for (int i = 0; i < m; i++) {
            res[i] = score[scanner.nextInt()];
        }
        for (int i = 0; i < m; i++) {
            System.out.print(res[i]+" ");
        }
    }
}
